import axios from 'axios'

// 创建axios实例
let base_url =  ucapUrl;
const service = axios.create({
  baseURL: base_url ,
  timeout: 100 * 1000, // 请求超时时间
})

service.interceptors.response.use(function (response) {
  
  if(response.data.code == -4){
    window.location.href = response.data.redirectUrl;
    return Promise.reject('token失效');
  }else{
    return response;
  }
}, function (error) {
  // 对响应错误做点什么
  return Promise.reject(error);
});

export default service
